<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="$!webPath/css/template.css"  rel="stylesheet" type="text/css">
    <link href="$!webPath/css/jquery-ui-1.8.22.custom.css" type=text/css rel=stylesheet>
    <script src="$!webPath/js/jquery.min.js"></script>
    <script src="$!webPath/js/jquery-ui-1.8.21.js"></script>
</head>
<body>
<div class="header_nav">
    <iframe name="content_frame" src="$!webPath/admin/nav" marginwidth=0 marginheight=0  frameborder=0 width=100% height=80/></iframe>
    <div class="cont_right"><a href="$!webPath/login">注销</a></div>
</div>
<div class="cont">
    <h3 class="seth">赛事管理</h3>
    <div class="nav_list">
        <ul>
            <li><a href="$!webPath/admin/matchList?size=10&page=0" class="this"><b>赛事列表</b></a></li>
            <li><a href="#" onclick="return adminMatch()"><b>添加赛事</b></a></li>
        </ul>
    </div>
    <div class="actifityContent">
        <h3>$!activity.activityName</h3>
        <div>
            <span>活动类型：$!activity.activityType</span>&nbsp;&nbsp;&nbsp;
            <span>活动场地：$!activity.activityLocation</span>&nbsp;&nbsp;&nbsp;
            <span>活动开始时间：$!activity.activityTime</span>&nbsp;&nbsp;&nbsp;
            <span>报名截止日期：$!activity.applyDeadLine</span>&nbsp;&nbsp;&nbsp;
            #if($!activity.activityStatus==1)<span>报名中</span>#elseif($!activity.activityStatus==2)<span>备战中</span>#elseif($!activity.activityStatus==3)<span>活动结束</span>#end
            <span>报名上限：$!activity.teamUpperLimit</span><br/>
            <span>创建者：$!activity.createdBy</span>&nbsp;&nbsp;&nbsp;<span>创建时间：$!activity.createdAt</span><br/>
            <span>更新者：$!activity.updateBy</span>&nbsp;&nbsp;&nbsp;<span>更新时间：$!activity.updateAt</span>
            #if($!activity.isRecommend==1)<span>推荐活动</span>#end
            #if($!activity.isNew==1)<span>新活动</span>#end

            <p>$!activity.activityIntroduction</p>
        </div>
    </div>
    <form action="$!webPath/admin/" method="post" id="ListForm" >
        <div class="fshoptb">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="fshop_table">
                <tr>
                    <th width="5%">序号</th>
                    <th width="5%" align="center">主队</th>
                    <th width="5%" align="center">客队</th>
                    <th width="10%" align="center">赛事结果</th>
                    <th width="5%" align="center">主队得分</th>
                    <th width="5%" align="center">客队得分</th>
                    <th width="20%" align="center">比赛时间</th>
                    <th width="10%" align="center">创建人</th>
                    <th width="10%" align="center">更新人</th>
                    <th align="center">操作</th>
                </tr>
                <tbody id="matchDetails">
                #set($i=0)
                #foreach($obj in $!matchDetails)
                <tr id="$!obj.id">
                    <td align="center"> #set($i=$i+1) $!i</td>
                    #set($homeTeam=$!teamTools.findTeamByTeamId("$!obj.homeTeamId"))
                    <td align="center">$!homeTeam.name</td>
                    #set($visitingTeam=$!teamTools.findTeamByTeamId("$!obj.visitingTeamId"))
                    <td align="center">$!visitingTeam.name</td>
                    #if($!obj.matchResult==0)
                    <td align="center">平局</td>
                    #elseif($!obj.matchResult==1)
                    <td align="center">主队胜</td>
                    #elseif($!obj.matchResult==2)
                    <td align="center">主队负</td>
                    #end
                    <td align="center">$!obj.homeScore</td>
                    <td align="center">$!obj.visitingScore</td>
                    <td align="center">$!obj.matchTime</td>
                    <td align="center">$!obj.createdBy</td>
                    <td align="center">$!obj.updateBy</td>

                    <td align="center" class="hui oprate_con">
                        <a href="#" onclick="return match_del('$!obj.id')" class="blue">删除</a>
                        <a href="$!webPath/admin/addMatch?matchId=$!obj.id&activityId=$!obj.activityByActiveId.id" class="blue">编辑</a>
                    </td>
                </tr>
                #end
                </tbody>
            </table>
         </div>
        <div class="operate_bar">
            <div class="fenye">
                $!gotoPageFormHTML
            </div>
        </div>
    </form>
</div>
<script>
    $(function(){
        getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }
        activityId=getUrlParam('activityId');
    })
    //替换指定传入参数的值,paramName为参数,replaceWith为新值
    function replaceParamVal(paramName,replaceWith) {
        var oUrl = this.location.href.toString();
        var re=eval('/('+ paramName+'=)([^&]*)/gi');
        var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
        this.location = nUrl;
    }
    function adminMatch(){
        window.location.href = "$!webPath/admin/addMatch?activityId="+activityId;
    }
    function match_del(id){
        if(confirm("你确定要删除吗？")){
            $.ajax({
                url:'$!webPath/admin/deleteMatch?matchId='+id,
                type:'delete',
                success: function () {
                    $('#'+id).remove();
                    window.location.reload();
                },
                error:function(){
                    alert('删除失败');
                }
            })
        }
    }

</script>
</body>
</html>
